<?php

function smarty_block_stu($attr, $content, &$smarty)
{
	//让标签只执行一次
	if(empty($content))return '';

 	$sql ="select * from stu limit {$attr['row']}";
 	$rows = query($sql);
 	$return ='';

 	foreach($rows as $r)
 	{
 		$tmp = $content;
 		foreach($r as $field=>$value)
 		{
 			$search = "[\$field['{$field}']]";
 			$tmp= str_replace($search, $value, $tmp);
 		}
 		$return.=$tmp;
 	}
 	return $return;
}

?>
